/*
 * @Description: 数据列表
 * @Author: chenju
 * @Date: 2022-01-18 17:21:29
 * @LastEditors: chenju
 * @LastEditTime: 2023-01-19 14:19:12
 */
import { get } from '@/utils/http';
import { BasicPagingListResult } from '@/apis/basicModel';
import {
  GetTaskDataSummaryListResult,
  systemNotifyListParams,
  SystemNotifyListResult,
  SystemNotifyDetailResult
} from './model/dataListModel';
enum Api {
  // 任务汇总
  TASK_SUMMARY = '/inventory/workbench/taskSummary',
  // 历年排放对比
  OVER_YEAR_EMISSION = '/inventory/workbench/overYearEmission',
  // 任务总量和进度
  TASK_EMISSION_RESULT = '/inventory/workbench/taskEmissionResult',
  // 排放类别占比
  EMISSION_CATEGORY_RATIO = '/inventory/workbench/emissionCategoryRatio',
  // 排放物占比
  EMISSION_RATIO = '/inventory/workbench/emissionRatio',
  // 能源流向
  ENERGY_FLOW = '/inventory/workbench/energyFlow',

  // 任务列表
  LIST_TASK_INFO = '/inventory/workbench/listTaskInfo'
}

// 任务汇总
export const taskSummary = (): Promise<GetTaskDataSummaryListResult> => get(Api.TASK_SUMMARY);

// 历年排放对比
export const overYearEmission = (organizationCode: string): Promise<GetTaskDataSummaryListResult> =>
  get(Api.OVER_YEAR_EMISSION, { organizationCode });

// 任务总量和进度
export const taskEmissionResult = (taskNo: string): Promise<GetTaskDataSummaryListResult> =>
  get(Api.TASK_EMISSION_RESULT, { taskNo });

// 排放类别占比
export const emissionCategoryRatio = (taskNo: string): Promise<GetTaskDataSummaryListResult> =>
  get(Api.EMISSION_CATEGORY_RATIO, { taskNo });

// 排放物占比
export const emissionRatio = (taskNo: string): Promise<GetTaskDataSummaryListResult> =>
  get(Api.EMISSION_RATIO, { taskNo });

// 能源流向
export const energyFlow = (taskNo: string): Promise<GetTaskDataSummaryListResult> =>
  get(Api.ENERGY_FLOW, { taskNo });

// 任务列表
export const listTaskInfo = (organizationCode: string): Promise<GetTaskDataSummaryListResult> =>
  get(Api.LIST_TASK_INFO, { organizationCode });

// 系统公告、帮助中心文件列表
export const systemNotifyList = (
  params: systemNotifyListParams
): Promise<BasicPagingListResult<SystemNotifyListResult>> => get(`/upms/systemNotify/page`, params);

// 系统公告详情
export const systemNotifyDetail = (id: number): Promise<SystemNotifyDetailResult> =>
  get(`/upms/systemNotify/detail`, { id });
